<?php

/**
 * Utilisateurs form base class.
 *
 * @method Utilisateurs getObject() Returns the current form's model object
 *
 * @package    espace14
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseUtilisateursForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'id_role'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Roles'), 'add_empty' => true)),
      'date_affiliation' => new sfWidgetFormDate(),
      'date_naissance'   => new sfWidgetFormDate(),
      'nom'              => new sfWidgetFormInputText(),
      'prenom'           => new sfWidgetFormInputText(),
      'identifiant'      => new sfWidgetFormInputText(),
      'motdepasse'       => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'id_role'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Roles'), 'required' => false)),
      'date_affiliation' => new sfValidatorDate(array('required' => false)),
      'date_naissance'   => new sfValidatorDate(),
      'nom'              => new sfValidatorString(array('max_length' => 100)),
      'prenom'           => new sfValidatorString(array('max_length' => 100)),
      'identifiant'      => new sfValidatorString(array('max_length' => 100)),
      'motdepasse'       => new sfValidatorString(array('max_length' => 100)),
    ));

    $this->widgetSchema->setNameFormat('utilisateurs[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Utilisateurs';
  }

}
